package com.sj.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.HashMap;

/**
 * TODO
 *
 * @author liufeng
 * @create 2017/8/9 15:54
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket productApi() {
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
                .select().apis(RequestHandlerSelectors.basePackage("com.sj"))
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("盛基java基础项目")
                .description("盛基基础项目api文档，对外Http接口")
                .termsOfServiceUrl("http://www.shengji.com/")
//                .contact(new Contact("liufeng","http://liufengvling.github.io","liufengvling@126.com"))
                .version("1.0")
                .build();
    }
}
